<!DOCTYPE html>
<html>
<head>
	<title>slave2</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="../src/cross-domain.js"></script>
</head>
<body>
	<div id="main">
		I am slave2 frame
		<button onclick="sendMesg()">send data</button>
	</div>
	<div id="content"></div>

</body>
<script type="text/javascript">
	var me = CD.component.name;
	function genInfo(name){
		return {info : "Hello [" + name + "] , I am [" + me + "] Now at " + new Date()};
	}
	function sendMesg (argument) {
		CD.send("MESTER" , "changeMaster" ,genInfo("MESTER"));
	}
	CD.extends("changeSlave2" , function(data){
		writeHtml(data.info);
	});
	function writeHtml(text){
		var content = document.getElementById("content");
		content.innerHTML += "<br/>" + text;
	}
	console.log(CD);
</script>
</html>
